package com.waqu.common.utils.other;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @ClassName RegularTools
 * @author tangjunfeng
 * @date 2016年6月3日 下午5:54:18
 */
public class RegularTools {

	public static boolean isMobilePhone(String tel) {
		Pattern p = Pattern.compile("(1)\\d{10}$");// ((13[0-9])|(15[^4，\\D])|(18[0,5-9])|(14[0-9]))\\d{8}$");
		boolean isExist = false;
		if (p.matcher(tel).matches())
			isExist = true;
		return isExist;
	}

	public static boolean isGlobalMobilePhone(String tel) {
		Pattern p = Pattern.compile("^(\\d|\\+|-|\\s){10,}$");
		boolean isExist = false;
		if (p.matcher(tel).matches())
			isExist = true;
		return isExist;
	}

	public static boolean isEmail(String str) {
		Pattern p1 = Pattern.compile("\\w+@(\\w+.)+[a-z]{2,3}");
		Matcher m = p1.matcher(str);
		return m.matches();
	}

	public static boolean isNumber(String str) {
		Pattern p1 = Pattern.compile("^[0-9_]+$");
		Matcher m = p1.matcher(str);
		return m.matches();
	}
	
}
